package demo.servlet;

import demo.util.Result;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 * @author lichenyi
 * @date 2017-11-13-0013.
 */
public abstract class BaseServlet<T> extends HttpServlet {

    @Override
    public void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException{
        //before
        System.out.println("before");
        Result<T> result = new Result<>();
        result.setResult(processGet(req, resp));
        //after
        System.out.println("after");
    }



    protected abstract <T> T processGet(HttpServletRequest req, HttpServletResponse resp);

}
